import type {RouteRecordRaw} from "vue-router";
import AdminView from "@/views/Admin/Index.vue";
import AdminHome from "@/views/Admin/Statistics/Index.vue"
import UserManage from "@/views/Admin/User/Index.vue";
import ArticleManage from "@/views/Admin/Article/Index.vue";
import CourseManage from "@/views/Admin/Course/Index.vue";
import WebsiteManage from "@/views/Admin/Website/Index.vue";
const adminRouter:Array<RouteRecordRaw> = [
    {
        path: '/admin',
        name: 'Admin',
        component: AdminView,
        redirect: ():string=> '/admin/statistics',
        meta: {requiresAuth: true, roles: ['admin']},
        children: [
            {
                path: '/admin/statistics',
                name: 'AdminStatistics',
                component: AdminHome,
                meta: {requiresAuth: true, roles: ['admin']},
            },
            {
                path: '/admin/user-manage',
                name: 'AdminUserManage',
                component: UserManage,
                meta: {requiresAuth: true, roles: ['admin']},
            },
            {
                path: '/admin/article-manage',
                name: 'AdminArticleManage',
                component: ArticleManage,
                meta: {requiresAuth: true, roles: ['admin']},
            },
            {
                path: '/admin/course-manage',
                name: 'AdminCourseManage',
                component: CourseManage,
                meta: {requiresAuth: true, roles: ['admin']},
            },
            {
                path: '/admin/website-manage',
                name: 'AdminWebsiteManage',
                component: WebsiteManage,
                meta: {requiresAuth: true, roles: ['admin']},
            },
        ]
    },
]

export default adminRouter